/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ueb13.uebOrder;

import de.htw.saarland.stl.Stdin;

public abstract class Dialog {
    
    protected static final String INFO = 
            "Zum beenden ende eingeben!\n<DATEINAME>";
    protected static final String ENDE    = "ende"; 
    protected static final char   TCHAR   = '*';
    
    protected static final int LAENGE = 80;
    
    private Dialog dialog = null;
    
    public String trennZeile() {
        StringBuilder trennzeile = new StringBuilder();
        for(int i = 0; i < LAENGE; i++) {
            trennzeile.append(TCHAR);
        }
        return trennzeile.toString();
    }
    
    public void setUp(Dialog dialog) {
        this.dialog = dialog;
        dialog.run();
    }
    
    public void run() {
        String command = "";
        boolean end = false;
        
        while (!end) {
            System.out.println(trennZeile());
            command = Stdin.readString(INFO);
            if(command.equalsIgnoreCase(ENDE))
                end = true;
            execute(command);
        }
        
        System.out.println("Das Programm wurde beendet!");
    }
    
    public void execute(String command) { }
    public static void  main(String[] args) {}
}